]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
loginDialog: Scale focusBin instead of resizing it
authorFlorian Müllner <fmuellner@gnome.org>
Thu, 12 Jul 2012 17:49:31 +0000 (19:49 +0200)
committerFlorian Müllner <fmuellner@gnome.org>
Wed, 18 Jul 2012 21:56:54 +0000 (23:56 +0200)
When setting an explicit size as we do currently, rounding errors
(for instance introduced by padding not specified in pixels) may
affect the parent's size allocation, e.g. making it shrink or grow
each time the size is reset.
Rather than taking care of possible rounding errors, set up focusBin
to take up the available width and use scaling for the animation.

https://bugzilla.gnome.org/show_bug.cgi?id=675076

js/gdm/loginDialog.js

index 53005b7eb84fb29f0c8ce7a5ece34058d4a2983d..fb4ad22c6aa70b49a3e2f39d5cd4f3edb60eda1e 100644 (file)
@@ -167,8 +167,9 @@ const UserListItem = new Lang.Class({
                                 expand: true });
 
         this._focusBin = new St.Bin({ style_class: 'login-dialog-user-list-item-focus-bin' });
+        this._focusBin.scale_gravity = Clutter.Gravity.CENTER;
         this._verticalBox.add(this._focusBin,
-                              { x_fill: false,
+                              { x_fill: true,
                                 x_align: St.Align.MIDDLE,
                                 y_fill: false,
                                 expand: true });
@@ -256,15 +257,10 @@ const UserListItem = new Lang.Class({
     showFocusAnimation: function(time) {
         let hold = new Batch.Hold();
 
-        let node = this.actor.get_theme_node();
-        let padding = node.get_horizontal_padding();
-
-        let box = this._verticalBox.get_allocation_box();
-
         Tweener.removeTweens(this._focusBin);
-        this._focusBin.width = 0;
+        this._focusBin.scale_x = 0.;
         Tweener.addTween(this._focusBin,
-                         { width: (box.x2 - box.x1 - padding),
+                         { scale_x: 1.,
                            time: time,
                            transition: 'linear',
                            onComplete: function() {
@@ -370,7 +366,7 @@ const UserList = new Lang.Class({
             let item = this._items[userName];
 
             item.actor.can_focus = false;
-            item._focusBin.width = 0;
+            item._focusBin.scale_x = 0.;
             if (item != exception)
                 tasks.push(function() {
                     return _fadeOutActor(item.actor);